@Kois
eu já tinha postado o Npc de food... ¬¬ ( mas oque vale é a intenção de ajudar
)
@MatheeussYuurii
Eu fiz igual ao PxG dois Npc, Mark e Hugh com os mesmos preços dos PxG vou postar logo os dois.
Npc Mark:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Mark" script="default.lua" walkinterval="350000" floorchange="0" speed="0">
<health now="150" max="150"/>
<look type="510" head="91" body="114" legs="86" feet="0"/>
<parameters>
<parameter key="message_greet" value="Hello dear customer! Are you here to see my offers? Come on, lets {trade}!"/>
<parameter key="message_farewell" value="Good bye!"/>
<parameter key="message_idletimeout" value="Good bye!"/>
<parameter key="message_walkaway" value="Good bye!"/>
<parameter key="module_shop" value="1"/>
<parameter key="shop_buyable" value="poke ball,2394,400;great ball,2391,1000;super ball,2393,1500;ultra ball,2392,2000;small potion,12347,500;super potion,12345,2000;great potion,12348,1500;ultra potion,12346,2200;full heal,12344,20000;revive,12343,30000;medicine,12349,300;recording camera,12330,100000;"/>
<parameter key="shop_sellable" value="essence of fire,12162,200;small stone,12337,90;pot of moss bug,12171,250;screw,12164,85;straw,2694,65;water gems,12161,20;remains of magikarp,12334,100;teeth,12175,100;bottle of poison,12165,100;water pendant,12170,800;feather,12200,500;seed,12163,25;pair of leaves,12155,500;apple bite,12173,450;bat wing,12182,550;"/>
</parameters>
</npc>
Npc Hugh:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Hugh" script="default.lua" walkinterval="350000" floorchange="0" speed="0">
<health now="150" max="150"/>
<look type="523" head="91" body="114" legs="86" feet="0"/>
<parameters>
<parameter key="message_greet" value="Hello dear customer! I buy rare items from Pokemon, Want to see my offers? Come on, let {} trade!"/>
<parameter key="message_farewell" value="Good bye!"/>
<parameter key="message_idletimeout" value="Good bye!"/>
<parameter key="message_walkaway" value="Good bye!"/>
<parameter key="module_shop" value="1"/>
<parameter key="shop_sellable" value="bag of pollem,12153,8000;Belt of Champion,12195,100000;Bird Beak,12172,10000;Blue Vines,12341,40000;Bone,12208,4000;Bug Antenna,12184,3500;Bulv,12154,3250;Chansey egg,12211,100000;Comb,5946,10000;Crab Claw,12207,2200;Dragon Tooth,12159,61000;Electric Box,12176,2000;Electric Tail,12169,100000;Farfetch'd Stick,12199,61000;Fox Tail,12180,65000;Fur,12181,1300;Future Orb,12194,1550;Gosme,12202,2250;Gyarados Tail,12148,80000;Horn,12178,2500;Ice Orb,12201,3250;Imam,12198,6000;Iron Bracelet,12192,25000;Locksmith of Shell,12203,8000;Luck Medalion,12186,100000;Mimic Clothes,12166,100000;Mushroom,12183,8000;Nail,12157,1000;Onix Tail,12205,100000;Pot Of Lava,12152,1800;Psychic Spoon,12193,4000;Punch Machine,12191,4000;Ruby,12188,2000;Sandbag,12177,1500;Scythe,12167,100000;Slow Tail,12197,8000;Squirtle Hull,12158,3250;Stone Orb,12196,1650;Traces of ghost,12204,2650;Venom Flute,12210,30000;Wool Ball,12187,8000;Thunder Feather,12150,500000;Ice Feather,12149,500000;Fire Feather,12151,500000;Psyduck Mug,12189,61000;Tongue,12209,100000;"/>
</parameters>
</npc>
@Pra galera que não sabe fazer npc de Duel
Eu vou postar um npc de Duel que fiz com base doque já tinha no server... vou postar porque tem gente que não sabe fazer ![]()
1º - Crie um arquivo.xml e coloquei isso dentro do arquivo:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Jack Black" script="duel jack black.lua" walkinterval="350000" floorchange="0" speed="0" lookdir="2">
<health now="150" max="150"/>
<look type="494" head="91" body="114" legs="86" feet="0"/>
<parameters>
</parameters>
</npc>
2º va na pasta scripts crie um arquivo .LUA com o nome de duel jack black.lua e coloque isso dentro do arquivo:
local focus = 0
local max_distance = 8
local talk_start = 0
local conv = 0
local fighting = false
local challenger = 0
local afk_limit_time = 30 -- seconds
local afk_time = 0 -- don't change
local battle_turn = 1 -- don't change
local challenger_turn = 0 -- don't change
local masterpos = {}
local time_to_fight_again = 15 -- seconds, not ms (so 30 * 60 means 30 minutes)
local can_walk = true -- true to make this npc walks randomly
local max_distance = 5 -- maximum distance this npc can get far (sqms)
local walk_delay = 7 -- every seconds make this npc walk
local cooldown_table = {}
local min_pokemons_to_battle = 1-- change to whatever you want
local number_of_pokemons = 0 -- don't change
local prizes = {
[1] = {{itemid = 2152, count = 1}},
[2] = {{itemid = 2152, count = 1}, {itemid = 2148, count = 50}},
[3] = {{itemid = 2152, count = 2}, {itemid = 2148, count = 60}},
[4] = {{itemid = 2152, count = 3}, {itemid = 2148, count = 70}},
[5] = {{itemid = 2152, count = 4}, {itemid = 2148, count = 80}},
[6] = {{itemid = 2152, count = 5}, {itemid = 2148, count = 90}}}
local pokemons = {
{name = "Rapidash", level = 55, extralevel = 55, sex = SEX_MALE, nick = "Rapidash", ball = "super"},
{name = "Wartortle", level = 45, extralevel = 60, sex = SEX_FEMALE, nick = "Wartortle", ball = "great"},
{name = "Dugtrio", level = 40, extralevel = 60, sex = SEX_MALE, nick = "Dugtrio", ball = "great"},
{name = "Graveler", level = 45, extralevel = 45, sex = SEX_MALE, nick = "Graveler", ball = "super"},
{name = "Tangela", level = 55, extralevel = 54, sex = SEX_FEMALE, nick = "Tangela", ball = "super"},
{name = "Raichu", level = 50, extralevel = 48, sex = SEX_MALE, nick = "Raichu", ball = "ultra"},
}
local function doSummonGymPokemon(npc)
local this = npc
if not isCreature(this) then return true end
if #getCreatureSummons(this) >= 1 or focus == 0 then return true end
local it = pokemons[battle_turn]
doSummonMonster(this, it.name)
local summon = getCreatureSummons(this)[1]
local balleffect = pokeballs["normal"].effect
if it.ball and pokeballs[it.ball] then
balleffect = pokeballs[it.ball].effect
end
doSendMagicEffect(getThingPos(summon), balleffect)
setPlayerStorageValue(summon, 10000, balleffect)
setPlayerStorageValue(summon, 10001, gobackmsgs[math.random(#gobackmsgs)].back:gsub("doka", it.nick ~= "" and it.nick or it.name))
setPlayerStorageValue(summon, 1007, it.nick ~= "" and it.nick or it.name)
doSetMonsterGym(summon, focus)
local name = it.nick ~= "" and it.nick or getCreatureName(this).."s "..it.name
setWildPokemonLevel(summon, it.level, getPokemonStatus(it.name, (it.extralevel + it.level)), name, 1.5)
doCreatureSay(this, gobackmsgs[math.random(#gobackmsgs)].go:gsub("doka", getPlayerStorageValue(summon, 1007)), 1)
fighting = true
battle_turn = battle_turn + 1
end
local function doWinDuel(cid, npc)
if not isCreature(cid) then return true end
local this = npc
local x = prizes[number_of_pokemons]
for n = 1, #x do
doPlayerAddItem(cid, x[n].itemid, x[n].count)
end
doCreatureSay(npc, "Congratulations! You won, here is your prize.", 1)
cooldown_table[getCreatureName(cid)] = os.clock() + time_to_fight_again
return true
end
function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
if focus == cid then
talk_start = os.clock()
end
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) <= 4 then
if cooldown_table[getCreatureName(cid)] and cooldown_table[getCreatureName(cid)] - os.clock() > 0 then
selfSay("Hello "..getCreatureName(cid)..", I really enjoyed our last battle!")
conv = 10
else
selfSay("Hello "..getCreatureName(cid)..", are you up to a duel? I can give prizes if you win!")
conv = 1
end
focus = cid
talk_start = os.clock()
return true
end
if (isDuelMsg(msg) or isConfirmMsg(msg)) and (conv == 1 or conv == 10) and focus == cid then
if conv == 10 then
selfSay("We have just battled! Please wait for me to recover from out last battle!")
focus = 0
return true
end
if not hasPokemon(cid) then
selfSay("You need pokemons to battle!")
return true
end
selfSay("Ok, tell me how many pokemons will fight.")
conv = 2
return true
end
if conv == 2 and focus == cid then
if not tonumber(msg) then
selfSay("Tell me the number of pokemons that will battle.")
return true
elseif tonumber(msg) > #pokemons then
selfSay("I have only "..#pokemons..", so the maximum is "..#pokemons.."!")
return true
elseif tonumber(msg) < min_pokemons_to_battle or tonumber(msg) < 1 then
selfSay("It has to be more than "..min_pokemons_to_battle..".")
return true
else
number_of_pokemons = tonumber(msg)
selfSay("Ok, the first that defeats "..number_of_pokemons.." wins, let's start!")
challenger = focus
setPlayerStorageValue(cid, 990, 1)
addEvent(doSummonGymPokemon, 850, getThis())
conv = 3
return true
end
return true
end
if isNegMsg(msg) and conv == 1 and focus == cid then
focus = 0
selfSay("It is better for you to refuse a battle against me!")
return true
end
if msgcontains(msg, 'bye') and focus == cid then
selfSay('Bye and do your best trainer!')
setPlayerStorageValue(focus, 990, -1)
focus = 0
return true
end
end
local afk_warning = false
local change = false
local walkdelay = 0
function onThink()
if not masterpos.x then
masterpos = getThingPos(getThis())
end
if focus == 0 then
selfTurn(2)
fighting = false
challenger = 0
change = false
challenger_turn = 0
battle_turn = 1
afk_time = 0
afk_warning = false
if #getCreatureSummons(getThis()) >= 1 then
setPlayerStorageValue(getCreatureSummons(getThis())[1], 1006, 0)
doCreatureAddHealth(getCreatureSummons(getThis())[1], -getCreatureMaxHealth(getCreatureSummons(getThis())[1]))
end
walkdelay = walkdelay - 0.5
if walkdelay <= 0 then
walkdelay = walk_delay
local pos = getThingPos(getThis())
local npos = {}
for a = 0, 3 do
if getDistanceBetween(getPosByDir(pos, a), masterpos) <= max_distance and canWalkOnPos(getPosByDir(pos, a), true, false, true, true, false) then
table.insert(npos, getPosByDir(pos, a))
end
end
if npos and #npos > 0 then
doTeleportThing(getThis(), npos[math.random(#npos)])
end
end
return true
else
if not isCreature(focus) then
focus = 0
return true
end
if fighting then
talk_start = os.clock()
if not isCreature(getCreatureTarget(getThis())) then
if #getCreatureSummons(challenger) >= 1 then
selfAttackCreature(getCreatureSummons(challenger)[1])
change = true
afk_time = 0
else
afk_time = afk_time + 0.5
if change then
change = false
challenger_turn = challenger_turn + 1
end
end
end
if afk_time > afk_limit_time then
setPlayerStorageValue(focus, 990, -1)
focus = 0
selfSay("I have waited too long, come back when you are ready!")
return true
end
if not afk_warning and afk_time > afk_limit_time / 2 then
selfSay("Where's your pokemon? Let's fight!")
afk_warning = true
end
if #getCreatureSummons(getThis()) == 0 then
if battle_turn > number_of_pokemons then
addEvent(doWinDuel, 1000, focus, getThis())
setPlayerStorageValue(focus, 990, -1)
focus = 0
return true
end
addEvent(doSummonGymPokemon, 1000, getThis())
end
if not hasPokemon(challenger) or challenger_turn > 6 or challenger_turn >= number_of_pokemons then
selfSay("You lost our duel! Maybe some other time you'll defeat me.")
setPlayerStorageValue(focus, 990, -1)
focus = 0
return true
end
end
local npcpos = getThingPos(getThis())
local focpos = getThingPos(focus)
if npcpos.z ~= focpos.z then
setPlayerStorageValue(focus, 990, -1)
focus = 0
selfSay("Bye then.")
return true
end
if (os.clock() - talk_start) > 30 then
selfSay("Good bye and keep training!")
setPlayerStorageValue(focus, 990, -1)
focus = 0
end
if getDistanceToCreature(focus) > max_distance then
setPlayerStorageValue(focus, 990, -1)
focus = 0
return true
end
local dir = doRedirectDirection(getDirectionTo(npcpos, focpos))
selfTurn(dir)
end
return true
end
pronto agora é só testar ![]()
comando para criar npc com o GOD /n nome do npc
Ajudei? REP+








info
Grupo: Cavaleiro
Registrado: 14/02/11
Posts: 164
Reputação: +12
é que tem o Mark que compra loot e o Hugh que compra loot que o Mark n compra, se tu n jogo svke ou pxg n vai saber .
Editado Abril 12 por MaatheeuusYuurii